# Create run moc on .h files. Add dependency but do not add to list of cpp to link
MACRO(QT4_MOC_H)
	FOREACH (_current_FILE ${ARGN})
		GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
		IF (EXISTS ${_abs_FILE})
			GET_FILENAME_COMPONENT(_filename ${_abs_FILE} NAME)
			GET_FILENAME_COMPONENT(_basename ${_abs_FILE} NAME_WE)
			QT4_GENERATE_MOC(${_filename} ${CMAKE_CURRENT_BINARY_DIR}/Qt4GeneratedFiles/moc_${_basename}.cpp)
			MACRO_ADD_FILE_DEPENDENCIES(${_basename}.cpp ${CMAKE_CURRENT_BINARY_DIR}/Qt4GeneratedFiles/moc_${_basename}.cpp)
		ENDIF (EXISTS ${_abs_FILE})
	ENDFOREACH (_current_FILE)
ENDMACRO(QT4_MOC_H)

# Create run moc on .cpp files. Add dependency but do not add to list of cpp to link
MACRO(QT4_MOC_CPP)
	FOREACH (_current_FILE ${ARGN})
		GET_FILENAME_COMPONENT(_abs_FILE ${_current_FILE} ABSOLUTE)
		IF (EXISTS ${_abs_FILE})
			GET_FILENAME_COMPONENT(_filename ${_abs_FILE} NAME)
			GET_FILENAME_COMPONENT(_basename ${_abs_FILE} NAME_WE)
			QT4_GENERATE_MOC(${_filename} ${CMAKE_CURRENT_BINARY_DIR}/Qt4GeneratedFiles/${_basename}.moc)
			MACRO_ADD_FILE_DEPENDENCIES(${_basename}.cpp ${CMAKE_CURRENT_BINARY_DIR}/Qt4GeneratedFiles/${_basename}.moc)
		ENDIF (EXISTS ${_abs_FILE})
	ENDFOREACH (_current_FILE)
ENDMACRO(QT4_MOC_CPP)
